# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)

add_definitions(-D CONFIG_TAR4ESP32)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

set(SOURCES_DIR
	./
)
set(BUILD_DIR
	./build/esp32
)
#查找所有.h头文件
file(GLOB_RECURSE 
	SOURCES_DIR
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	CONFIGURE_DEPENDS 
	src/*.h src/*.hpp
)

#从.h文件中剥离出其所在的目录
foreach(src ${SOURCES_DIR})
	string(FIND ${src} "/" LastIndex REVERSE)
	string(SUBSTRING ${src} 0 ${LastIndex} inc)
	list(APPEND PATH_INCS ${inc})
endforeach(src)

#头文件包含路径
include_directories(
	#build
	${BUILD_DIR}
	${BUILD_DIR}/py_cpp
	#inc
	${PATH_INCS}
	inc
	#eigen
	libs/generic/eigen-3.4.0/include/eigen3/Eigen
)

set(SRC
	${SOURCES_CPP}
)

#查找所有.c .cpp源代码文件
file(GLOB_RECURSE 
	SOURCES_CPP
	RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
	CONFIGURE_DEPENDS 
	src/*.c src/*.cpp ${BUILD_DIR}/py_cpp/*.cpp
)

foreach(cpp ${SOURCES_CPP})
	list(APPEND CPP_FILES "../${cpp}")
endforeach(cpp)

project(quad_remote_controller)
